﻿<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8" />
    <title>@ViewBag.Title</title>
    <link href="@Url.Content("~/Content/Site.css")" rel="stylesheet" type="text/css" />
    <link href="@Url.Content("~/Content/jquery-ui-1.8.17.custom.css")" rel="stylesheet" type="text/css" />
    <script src="@Url.Content("~/Scripts/jquery-1.5.1.min.js")" type="text/javascript"></script>
    <script src="@Url.Content("~/Scripts/modernizr-1.7.min.js")" type="text/javascript"></script>
    <script src="@Url.Content("~/Scripts/jquery-1.7.1.min.js")" type="text/javascript"></script>
    <script src="@Url.Content("~/Scripts/jquery-ui-1.8.17.custom.min.js")" type="text/javascript"></script>
    <style type="text/css">
        .ui-button
        {
            margin-left: -1px;
        }
        .ui-button-icon-only .ui-button-text
        {
            padding: 0.35em;
        }
        .ui-autocomplete-input
        {
            margin: 0;
            padding: 0.48em 0 0.47em 0.45em;
            width: 400px;
        }
    </style>
</head>
<body>
    <div class="page">
        <header>
            <script type="text/javascript">
                var selEnvToPublish = "Staging";
                
                function SelectPage(selObj) {
                    SetHref(selObj.value);
                }

                function SetHref(href) {
                    window.location.href = href;
                }

                function GenerateVersion() {
                    var retVal = confirm("Press OK to generate next version.");
                    if (retVal > 0) {
                        SetHref("/Home/GenerateVersion");
                    }
                }

                function SetPublishEnv(selection) {
                    selEnvToPublish = selection.value;
                    if (selEnvToPublish == "Production") {
                        $("#versionNumber").attr('disabled', true);
                    } else {
                        $("#versionNumber").removeAttr('disabled');
                    }
                }

                function PublishTo() {
                    var vNumber = $("#versionNumber").val();

                    var retVal = confirm("Are you sure you want to publish your changes to " + selEnvToPublish +
                                          "?.\r\n\r\nThis process is current not reversable.");
                    if (retVal > 0) {
                        if (selEnvToPublish == "Production") {
                            SetHref("/Home/PublishToProd");
                        } else {
                            if (vNumber == "") {
                                alert("Please enter the version to publish.");
                            } else {
                                SetHref("/Home/PublishToStaging?version=" + vNumber);
                            }
                        }
                    }
                }

            </script>
            <div id="title">
                <h1>Chronozoom Content Authoring - @System.Web.Configuration.WebConfigurationManager.AppSettings["Environment"]</h1>
            </div>
            <div id="logindisplay">
                @Html.Partial("_LogOnPartial")
            </div>
            @if ((Session["userrole"] != null) && (Session["userrole"].ToString() == "Guest" || Session["userrole"].ToString() == "Author" || Session["userrole"].ToString() == "Admin" || Session["userrole"].ToString() == "SuperAdmin"))
            {
            <div style="text-align:right;width:100%">
                <span>[Version</span>
                <span>[Max: @ViewBag.MaxVersion]</span>
                <span>[Staging: @ViewBag.StagingVersion]</span>
                <span>[Production: @ViewBag.ProductionVersion]]</span>
            </div>
            }
            <nav>
                <ul id="menu">
                    <li>@Html.ActionLink("Home", "Index", "Home")</li>                                    
                </ul>
            </nav>
            @if ((Session["userrole"] != null) && (Session["userrole"].ToString() == "Guest" || Session["userrole"].ToString() == "Author" || Session["userrole"].ToString() == "Admin" || Session["userrole"].ToString() == "SuperAdmin"))
            {
                <table style="width:100%;">
                    <tr>
                        <td style="width:200px;">
                            <select onchange="SelectPage(this)" style="width:200px;">
                                <option></option>                    
                                   <option value="/Contentitem/">Contentitem</option>                    
                                <option value="/Exhibit/">Exhibit</option>                    
                               <option value="/ExhibitContentItem/">ExhibitContentItem</option>                    
                                <option value="/Timeline/">Timeline</option>                    
                                <option value="/TimelineExhibit/">TimelineExhibit</option>                    
                                <option value="/Bookmark/">Bookmark</option>                    
                               <option value="/Tour/">Tour</option>                    
                                <option value="/TourBookmark/">TourBookmark</option>                    
                                 <option value="/Reference/">Reference</option>                    
                                <option value="/ExhibitReference/">ExhibitReference</option>                    
                               <option value="/Keyword/">Keyword</option>                    
                                <option value="/ContentKeyword/">ContentKeyword</option> 
                                <option value="/CitationType/">CitationType</option>                    
                                <option value="/ExhibitKeyword/">ExhibitKeyword</option>                    
                                <option value="/ReferenceKeyword/">ReferenceKeyword</option>                    
                                @if ((Session["userrole"] != null) && (Session["userrole"].ToString() == "Admin" || Session["userrole"].ToString() == "SuperAdmin"))
                                {
                                        <option value="/LicenseType/">LicenseType</option>                    
                                        <option value="/MediaType/">MediaType</option>                    
                                        <option value="/Regime/">Regime</option>                    
                                        <option value="/Threshold/">Threshold</option>                    
                                        <option value="/TimeUnit/">TimeUnit</option>  
                                        <option value="/User/">User</option>  
                                        <option value="/Permission/">Permission</option>  
                                        <option value="/Role/">Role</option>  
                                        <option value="/AuthoringRolePermissions/">AuthoringRolePermissions</option>  
                                }  
                            </select>
                        </td>
              @if ((Session["userrole"] != null) && (Session["userrole"].ToString() == "Author" || Session["userrole"].ToString() == "Admin" || Session["userrole"].ToString() == "SuperAdmin"))
              {
                      <td style="text-align:right;display:block" id="versionColumn">
                                <input type="button" value="Generate Version" onclick="GenerateVersion()"/>
    
                                <div style="text-align:right;margin-top:2px">
                                            <span>Publish Settings:</span>
                                    <select onchange="SetPublishEnv(this)">
                                        <option selected="selected">Staging</option>
                                        <option>Production</option>
                                    </select>
                                    <input type="text" maxlength="4" style="width:40px" id="versionNumber"/>
                                            <input type="button" value="Publish" onclick="PublishTo()"/>
                                </div>
                                <div style="text-align:right;margin-top:2px">
                                            <span>Rollback Version:</span>
                                    <input type="text" maxlength="4" style="width:40px" id="rollbackNumber"/>
                                    <input type="button" value="Rollback" onclick="PublishTo()"/>
                                </div>
                        </td>
                        <td style="text-align:right;display:none" id="operationUnderway">
                                <span>Processing Request</span>
                        </td>
              }
                    </tr>
                </table>
            }
        </header>
        <section id="main" width="100%">
            @RenderBody()
        </section>
        <footer>
        </footer>
    </div>
</body>
</html>
